home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr26
/
netprog.zip
/
NETPROG.TAR
/
ping
/
finish.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-12-17
|
613b
|
24 lines
/*
* Print out statistics, and stop.
* We're called both when a SIGINT signal is received, or if the
* specified number of packets have been received.
*/
#include "defs.h"
sig_finish()
{
printf("\n----%s PING Statistics----\n", hostname );
printf("%d packets transmitted, ", ntransmitted );
printf("%d packets received, ", nreceived );
if (ntransmitted)
printf("%d%% packet loss",
(int) (((ntransmitted-nreceived)*100) / ntransmitted) );
printf("\n");
if (nreceived && timing)
printf("round-trip (ms) min/avg/max = %d/%d/%d\n",
tmin, tsum / nreceived, tmax );
fflush(stdout);
exit(0);
}